package  
{
	import flash.display.MovieClip;
	
	/**
	 * ...
	 * @author Thiago Gomes da Silva
	 */
	public class Backgrounder extends MovieClip 
	{
		private var player:Player;
		private var speedY:Number;
		private var main:Main;
		
		public function Backgrounder(player:Player, speedY:Number, main:Main) 
		{
			this.player = player;
			this.speedY = speedY;
			this.main = main;
		}
		
		public function update()
		{
			if (player.isMoving())
			{
				if (player.y < player.height * 2)
				{
					player.y = player.height * 2;
					if (this.y < 0)
					{
						this.y += speedY;
					}
				}
				else if (player.y >= this.main.stage.stageHeight - player.height)
				{
					player.y = this.main.stage.stageHeight - this.player.height;
					if (this.y + this.height > main.stage.stageHeight)
					{
						this.y -= speedY;
						
					}
				}
				
				
				
				
				
				
				
				
				
			}
		}
	}

}